package com.turing.post.salesmanage.util;

import java.math.BigInteger;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * 赎回单明细
 * 
 * @author yxb
 * @date 2013-01-22
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "RedempOrderDetail")
@IdClass(RedempOrderDetail.class)
public class RedempOrderDetail implements java.io.Serializable {

	private BigInteger redempOrderId;
	private String cardNo;// 卡号 varchar(19) Not Null
	private BigInteger masterAccNo;// (UNI) 主帐号 int Not Null 参考MasterAccount
	private BigInteger beforeBalance;// 原余额 decimal(16) Not Null
	private BigInteger redempAmount;// 赎回金额 decimal(16) Not Null >= 0
	private BigInteger factRedempAmount;// 实际赎回金额 decimal(16) Not Null >= 0
	private BigInteger fee;// 手续费 decimal(16) Not Null >= 0
	private BigInteger factFee;// 实收手续费
	private BigInteger balance;// 赎回后余额 decimal(16) Not Null >= 0
	private BigInteger ownerId;// (FK) 持卡人Id Int Null
	private String remark;// 备注 varchar(255) Null

	public RedempOrderDetail() {

	}

	@Id
	@Column(name = "REDEMPORDERID")
	public BigInteger getRedempOrderId() {
		return redempOrderId;
	}

	public void setRedempOrderId(BigInteger redempOrderId) {
		this.redempOrderId = redempOrderId;
	}

	@Column(name = "CARDNO")
	public String getCardNo() {
		return cardNo;
	}

	public void setCardNo(String cardNo) {
		this.cardNo = cardNo;
	}

	@Id
	@Column(name = "MASTERACCNO")
	public BigInteger getMasterAccNo() {
		return masterAccNo;
	}

	public void setMasterAccNo(BigInteger masterAccNo) {
		this.masterAccNo = masterAccNo;
	}

	@Column(name = "BEFOREBALANCE")
	public BigInteger getBeforeBalance() {
		return beforeBalance;
	}

	public void setBeforeBalance(BigInteger beforeBalance) {
		this.beforeBalance = beforeBalance;
	}

	@Column(name = "REDEMPAMOUNT")
	public BigInteger getRedempAmount() {
		return redempAmount;
	}

	public void setRedempAmount(BigInteger redempAmount) {
		this.redempAmount = redempAmount;
	}

	@Column(name = "FACTREDEMPAMOUNT")
	public BigInteger getFactRedempAmount() {
		return factRedempAmount;
	}

	public void setFactRedempAmount(BigInteger factRedempAmount) {
		this.factRedempAmount = factRedempAmount;
	}

	@Column(name = "FEE")
	public BigInteger getFee() {
		return fee;
	}

	public void setFee(BigInteger fee) {
		this.fee = fee;
	}

	@Column(name = "factFee")
	public BigInteger getFactFee() {
		return factFee;
	}

	public void setFactFee(BigInteger factFee) {
		this.factFee = factFee;
	}

	@Column(name = "BALANCE")
	public BigInteger getBalance() {
		return balance;
	}

	public void setBalance(BigInteger balance) {
		this.balance = balance;
	}

	@Column(name = "OWNERID")
	public BigInteger getOwnerId() {
		return ownerId;
	}

	public void setOwnerId(BigInteger ownerId) {
		this.ownerId = ownerId;
	}

	@Column(name = "REMARK")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((getMasterAccNo() == null) ? 0 : getMasterAccNo().hashCode());
		result = prime
				* result
				+ ((getRedempOrderId() == null) ? 0 : getRedempOrderId()
						.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final RedempOrderDetail other = (RedempOrderDetail) obj;
		if (getMasterAccNo() == null) {
			if (other.getMasterAccNo() != null)
				return false;
		} else if (!getMasterAccNo().equals(other.getMasterAccNo()))
			return false;
		if (getRedempOrderId() == null) {
			if (other.getRedempOrderId() != null)
				return false;
		} else if (!getRedempOrderId().equals(other.getRedempOrderId()))
			return false;
		return true;
	}

}